package com.jinkaimen.goodcash.ui.holder;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.ht.baselibs.ui.base.BaseViewHolder;
import com.jinkaimen.goodcash.R;
import com.jinkaimen.goodcash.bean.ReportShoperManagerItemBean;

public class PassShoperManagerViewHolder extends BaseViewHolder<ReportShoperManagerItemBean> {

    private final Activity mActivity;
    private TextView mShortNameView;
    private TextView mNumberView;
    private TextView mMoneyView;
    private TextView mNameView;
    private TextView mAddress;

    public PassShoperManagerViewHolder(Activity activity) {
        super(R.layout.list_pass_shop_manager_item);
        this.mActivity = activity;
    }

    @Override
    protected void initView() {

        mShortNameView = findViewById(R.id.tv_list_shop_manager_item_shop_short_name);
        mNumberView= findViewById(R.id.tv_list_shop_manager_item_number);
        mMoneyView= findViewById(R.id.tv_list_shop_manager_item_money);
        mNameView= findViewById(R.id.tv_list_shop_manager_item_shop_name);
        mAddress= findViewById(R.id.tv_list_shop_manager_item_shop_address);

    }

    @Override
    protected void refreshView(final ReportShoperManagerItemBean reportShoperManagerItemBean) {
        mShortNameView.setText(reportShoperManagerItemBean.shortName);
        mNumberView.setText(reportShoperManagerItemBean.countTrade+"笔");
        mMoneyView.setText(reportShoperManagerItemBean.totalTradeAmount+"元");
        mNameView.setText(reportShoperManagerItemBean.name);
        mAddress.setText("地址："+reportShoperManagerItemBean.address);


        findViewById(R.id.tv_list_shop_manager_item_shop_photo).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_DIAL);
                Uri data = Uri.parse("tel:" + reportShoperManagerItemBean.contactCellphone);
                intent.setData(data);
                mActivity.startActivity(intent);
            }
        });
    }
}
